Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Windows.Forms

Public Class FrmCrTonCongNo_NhaCungCap
    Private thang, nam, reportPath As String
    Private customerReport As ReportDocument
    Private flagInHoaDon As Integer = 0

    Private Sub FrmCrTonCongNo_NhaCungCap_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        frmLoading.Show()
        Dim sqlQuery As String = "SELECT t1.*, t2.ten_nhacungcap FROM tbl_dot_toncongno_nhacungcap as t1 left join tbl_nhacungcap as t2 on t1.ma_nhacungcap=t2.ma_nhacungcap where recycleID='" & nam & thang & "' AND (thanhtien_dauky <> 0 OR phatsinhno_trongky <> 0 OR thanhtoan_trongky <> 0 OR thanhtien_cuoiky <> 0)ORDER BY t2.ten_nhacungcap "
        If flagInHoaDon = 0 Then
            reportPath = Application.StartupPath & "\" & "crTonCongNoNhaCungCap.rpt"
        Else
            reportPath = Application.StartupPath & "\" & "crTonCongNoNhaCungCap_ketoan.rpt"
        End If
        customerReport = New ReportDocument()
        customerReport.Load(reportPath)
        customerReport.SetDataSource(moduleReportConfig.GetDataTable(sqlQuery))
        customerReport.SetParameterValue("TThang", thang)
        customerReport.SetParameterValue("TNam", nam)
        customerReport.SetParameterValue("company", globalVariale.COMPANY)
        customerReport.SetParameterValue("address", globalVariale.ADDRESS)
        Me.CrNXTTongHopview.ReportSource = customerReport
        frmLoading.Close()
        frmLoading.Dispose()
    End Sub
    Public Sub setThang(ByVal s As String)
        thang = s
    End Sub

    Public Sub setNam(ByVal s As String)
        nam = s
    End Sub
    Public Sub setInHoaDon(ByVal s As Integer)
        Me.flagInHoaDon = s
    End Sub

End Class
